package myarray

func twoSum(nums []int, target int) []int {

	n := len(nums)
	if n < 2 {
		return nil
	}
	m := make(map[int]int)
	for x, v := range nums {
		temp := target - v
		if val, ok := m[temp]; ok {
			return []int{x, m[temp]}
		} else {
			m[temp] = val
		}
	}
	return nil
}
